# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-misc/xnc/Attic/xnc-5.0.4.ebuild,v 1.13 2009/09/04 08:28:43 ssuominen dead $

EAPI="3"

inherit eutils

DESCRIPTION="file manager for X Window system very similar to Norton Commander"
HOMEPAGE="http://xnc.dubna.su/"
SRC_URI="http://xnc.dubna.su/src-5/${P}.src.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ppc ~sparc ~x86 ~x86-fbsd"
IUSE="nls -unicode"

RDEPEND="x11-libs/libX11
	x11-libs/libXt
	x11-libs/libXext
	media-libs/libpng
	media-libs/tiff
	media-libs/libjpeg-turbo"
DEPEND="${RDEPEND}
	x11-proto/xextproto
	x11-proto/xproto"

src_unpack() {
    unpack $A || die "unpack failed"
}

src_prepare() {
    epatch "${FILESDIR}"/xnc-5.0.4-man_page.cxx.patch || die "man_page patch failed"
    epatch "${FILESDIR}"/xnc-5.0.4-gcc44.patch || die "gcc44 patch failed"
    epatch "${FILESDIR}"/xnc-5.0.4-IMG_png.c.patch || die "IMG_png patch failed"

    if use unicode; then
        epatch "${FILESDIR}"/xnc-5.0.4-utf8.patch || die "utf8 patch failed"
        cp "${FILESDIR}"/myxlib.cxx "${S}"/src/lib/northgui/ || die "cp myxlib.cxx failed"
        cp "${FILESDIR}"/myxlib.h "${S}"/src/include/xnc/ || die "cp myxlib.h failed"
    fi
}

src_configure() {
	econf \
		--host=${CHOST} \
		--prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		$(use_enable nls) \
		|| die "configure failed"
}

src_compile() {
	emake -j1 DESTDIR="${D}" || die "compile failed"
}

src_install() {
	emake -j1 DESTDIR="${D}" install || die
	dodoc AUTHORS ChangeLog LICENSE README TODO
}
